#!/bin/bash
set -e
set +o noglob
DIR="$(cd "$(dirname "$0")" && pwd)"
source $DIR/common.sh

item=0
h2 "[Step $item]: get cri-docker rpm ..."; let item+=1
wget https://github.com/Mirantis/cri-dockerd/releases/download/v0.3.12/cri-dockerd-0.3.12-3.el7.x86_64.rpm
h2 "[Step $item]: install cri-docker rpm ..."; let item+=1
rpm -ivh cri-dockerd-0.3.12-3.el7.x86_64.rpm
h2 "[Step $item]: update cri-docker.service ..."; let item+=1
sed -i  's#ExecStart=/usr/bin/cri-dockerd --container-runtime-endpoint fd://#ExecStart=/usr/bin/cri-dockerd --container-runtime-endpoint fd:// --pod-infra-container-image=registry.aliyuncs.com/google_containers/pause:3.9#' /usr/lib/systemd/system/cri-docker.service
h2 "[Step $item]: Load configuration ..."; let item+=1
systemctl daemon-reload
h2 "[Step $item]: enable cri-docker ..."; let item+=1
systemctl enable cri-docker && systemctl start cri-docker
